package com.example.loginpage.InputUtil

import android.content.Context
import android.net.Uri
import androidx.core.content.FileProvider
import java.io.File

class FileProvider : FileProvider() {
    companion object {
        //生成供相机应用保存照片的临时文件Uri
        fun getImageUri(context: Context): Uri {
            //在Cache文件夹内创建临时图片文件
            val directory = File(context.cacheDir, "images")
            directory.mkdirs()
            val imageTempfile = File.createTempFile(
                "selected_image_",
                ".jpg",
                directory
            )
            var authority = context.packageName + ".InputUtil.FileProvider"

            return getUriForFile(context,
                "${context.packageName}.InputUtil.FileProvider",
                imageTempfile)
        }
    }
}